//
//  NetworkManager.h
//  SchoolHelper
//
//  Created by 任辰东 on 2018/3/26.
//  Copyright © 2018年 JSY. All rights reserved.
//

#import "AFHTTPSessionManager.h"

//请求成功回调block
typedef void (^requestSuccessBlock)(NSNumber *code, NSString *msg,id responseData);

//请求失败回调block
typedef void (^requestFailureBlock)(NSNumber *code, NSString *msg);

@interface NetworkManager : AFHTTPSessionManager

+ (instancetype)sharedManager;

/**
 自封装GET请求
 
 @param urlString 请求连接
 @param params 请求参数
 @param completionBlock 成功后返回的Block
 @param errorBlock 失败后返回的Block
 */
-(void)getDataWithURL:(NSString *)urlString withParams:(NSDictionary *)params onCompletion:(requestSuccessBlock)completionBlock onError:(requestFailureBlock)errorBlock;
/**
 自封装POST请求
 
 @param urlString 请求连接
 @param params 请求参数
 @param completionBlock 成功后返回的Block
 @param errorBlock 失败后返回的Block
 */
-(void)postDataWithURL:(NSString *)urlString withParams:(NSDictionary *)params onCompletion:(requestSuccessBlock)completionBlock onError:(requestFailureBlock)errorBlock;

@end
